<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head>
	<title>物料详细信息</title>
</head>

<body>

	<form action="" method="post">
		<c:if test="${!empty visitor &&visitor.adminGrade <=1}">
		<c:if test="${empty display['material'].bomMaterials}">
			<button type="button" class="askAgain" onClick="buttonAction(this,'m!delete.z?id=${display['material'].id}')">
				删除
			</button>
		</c:if>
		<button type="button" onClick="buttonAction(this,'m!toUpdate.z')">
			修改
		</button>
		<button type="button" onClick="buttonAction(this,'up!toUpload.z?ownId=${display['material'].id}')">
			添加附件
		</button>
		</c:if>
		<button type="button" onClick="buttonAction(this,'m!all.z')">
			返回列表
		</button>
	</form>

	<table class="list">
		<thead>
			<tr title="">
				<th>
					物料编号
				</th>
				<th>
					物料名称
				</th>
				<th>
					规格型号
				</th>
				<th>
					器件描述
				</th>
				<th>
					PCB封装
				</th>
				<th>
					临时编码
				</th>
				<th>
					采购状态
				</th>
			</tr>
		</thead>
		<tr>
			<td>
				${display['material'].code }
			</td>
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=name&page.currentPage=1">${display['material'].name }</a>
			</td>
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=specification&page.currentPage=1">${display['material'].specification }</a>
			</td>
			
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=description&page.currentPage=1">${display['material'].description }</a>
			</td>
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=pcbDecal&page.currentPage=1">${display['material'].pcbDecal }</a>
			</td>
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=tmpCode&page.currentPage=1">${display['material'].tmpCode }</a>
			</td>
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=state&page.currentPage=1">${display['material'].state }</a>
			</td>
		</tr>
	</table>
	
	<table class="list">
		<thead>
			<tr title="">
				<th>
					器件封装
				</th>
				<th>
					品牌
				</th>
				<th>
					供货商
				</th>
				<th>
					备注
				</th>
			</tr>
		</thead>
		<tr>
			<td>
				<a href="m!same.z?id=${display['material'].id}&likeField=footprint&page.currentPage=1">${display['material'].footprint }</a>
			</td>
			<td>
				${display['material'].brand }
			</td>
			<td>
				${display['material'].supplier }
			</td>
			<td>
				${display['material'].remark }
			</td>
		</tr>
	</table>
	
	<table class="list">
		<caption>
			附件表
		</caption>
		<thead>
			<tr title="">
				<th>
					文件名
				</th>
				<th>
					创建时间
				</th>
				<th>
					删除附件
				</th>
			</tr>
		</thead>
		<c:forEach var="upload" items="${display['material'].uploads}">
		<tr>
			<td>
				<a href="up!download.z?id=${upload.id}">${upload.fileName }</a>
			</td>
			<td>
				${upload.createTime }
			</td>
			<td>
				<a href="mup!delete.z?id=${upload.id}" class="askAgain">删除附件（谨慎）</a>
			</td>
		</tr>
		</c:forEach>
	</table>

	<table class="list">
		<caption>
			BOM物料表
		</caption>
		<thead>
			<tr title="点击表头可排序">
				<th>
					所属BOM
				</th>
				<th>
					物料编号
				</th>
				<th>
					元件编号
				</th>
				<th>
					规格描述
				</th>
				<th>
					PCB封装
				</th>
				<th>
					值
				</th>
				<th>
					电压
				</th>
				<th>
					数量
				</th>
				<th>
					材料选择
				</th>
				
			</tr>
		</thead>
		<c:forEach var="bomMaterial" items="${display['material'].bomMaterials}">
			<tr>
				<td>
					<a href="b!display.z?id=${bomMaterial.bom.id}">${bomMaterial.bom.code
						} VER. ${bomMaterial.bom.version } </a>
				</td>
				<td>
					${bomMaterial.code }
				</td>
				<td>
					${bomMaterial.designator }
				</td>
				<td>
					${bomMaterial.comment }
				</td>
				<td>
					${bomMaterial.footprint }
				</td>
				<td>
					${bomMaterial.value }
				</td>
				<td>
					${bomMaterial.voltage }
				</td>
				<td>
					${bomMaterial.quantity }
				</td>
				<td>
					${bomMaterial.stuffOpt }
				</td>
				
			</tr>
		</c:forEach>
	</table>
</body>